#pragma once

#include <nxos.h>
#include <wm/input.h>

#define WM_INPUT_DEVICE_NR 3 

typedef struct
{
    /* mouse */
    int mouse_x, mouse_y;
    int prev_mouse_x, prev_mouse_y;

    /* keyboard */
    int led_state;
    int key_modify;

    NX_Solt kbd_solt;
    NX_Solt mouse_solt;
    NX_Solt joystick_solt;
} WM_Input;

NX_IMPORT WM_Input g_wm_input;

NX_Error WM_InputInit(void);
NX_Error WM_InputExit(void);
NX_Error WM_InputRead(NX_Solt solt);

void WM_MouseMotion(int x_rel, int y_rel);
void WM_MouseWheel(int z_rel);
void WM_MouseButtonDown(int button);
void WM_MouseButtonUp(int button);

void WM_KeyboardDown(int keycode);
void WM_KeyboardUp(int keycode);

/* drivers */
NX_Error WM_InputMouseInit(void);
NX_Error WM_InputMouseExit(void);
NX_Error WM_InputKeyboardInit(void);
NX_Error WM_InputKeyboardExit(void);
NX_Error WM_InputJoystickInit(void);
NX_Error WM_InputJoystickExit(void);
